# src/CryptographyTools/CMakeLists.txt

# 获取当前源文件所在目录的绝对路径
get_filename_component(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)

# 将该目录下所有源文件添加到 SRC_LIST 变量中
aux_source_directory(${SRC_DIR} SRC_LIST)

# 查找 Protobuf
# find_package(Protobuf REQUIRED)

# 设置 Protobuf 文件
set(PROTOBUF_FILES ${PROJECT_SOURCE_DIR}/src/DDAP/DDAP.pb.cc)

# 设置 Protobuf 库路径
set(PROTOBUF_LIBRARY ${PROJECT_PROTOBUF_LIBRARY})

# 创建静态库
# add_library(utilTool_lib SHARED ${SRC_LIST} ${PROTOBUF_FILES})
add_library(utilTool_lib SHARED ${SRC_LIST})
set_target_properties(utilTool_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
# 设置包含目录
# target_include_directories(utilTool_lib PUBLIC ${PROJECT_OPENSSL_INCLUDE_DIR} ${PROTOBUF_INCLUDE_DIR})

# 链接库，直接指定库文件的路径
# target_link_libraries(utilTool_lib PRIVATE log_lib DDAP_lib CryptoTools_lib ${PROJECT_OPENSSL_LIBRARIES} ${PROTOBUF_LIBRARY})
target_link_libraries(utilTool_lib PRIVATE DDAP_lib ${PROJECT_OPENSSL_LIBRARIES} ${PROTOBUF_LIBRARY})
# 设置目标属性
# set_target_properties(utilTool_lib PROPERTIES
#     INSTALL_RPATH_USE_LINK_PATH TRUE  # 在安装时使用链接路径作为 RPATH
#     BUILD_WITH_INSTALL_RPATH TRUE     # 在构建时使用安装 RPATH
#     INSTALL_RPATH ${PROJECT_CMAKE_INSTALL_RPATH}
#     BUILD_RPATH ${PROJECT_CMAKE_BUILD_RPATH}
# )